package interview.hw_od;

import java.util.Scanner;

/**
 * 查字典 https://codefun2000.com/p/P1333
 * 题目简述：输入一个单词前缀和一个字典，输出包含该前缀的单词
 */
public class SearchPrefix {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ss = sc.nextLine().split(" ");
        String str = ss[0];
        boolean flag = false;
        for (int i = 2;i < ss.length;i++) {
            if (ss[i].startsWith(str)) {
                flag = true;
                System.out.println(ss[i]);
            }
        }
        if (!flag) System.out.println(-1);
    }
}
